import { createStore, createLogger } from 'vuex';

import createPersistedstate from 'vuex-persistedstate';
import Cookies from "js-cookie"
import user from './modules/user';
import cart from './modules/cart';
import category from './modules/category';


export type State = {
  name: string
}
export default createStore({
  strict: true,
  state: () => {

  },
  mutations: {

  },
  actions: {

  },
  modules: {
    cart,
    user,
    category
  },
  plugins: [
    createPersistedstate({
      storage: {
        getItem: (key) => Cookies.get(key),
        setItem: (key, value) =>
          Cookies.set(key, value, { expires: 3, secure: true }),
        removeItem: (key) => Cookies.remove(key)
      }
    }),
    createLogger()
  ]
})
